<?php
namespace isoftstone\ueditor\Listener;

use Flarum\Event\ConfigureForumRoutes;
use Illuminate\Contracts\Events\Dispatcher;

class AddApplicationRoute
{
    /**
     * @param Dispatcher $events
     */
    public function subscribe(Dispatcher $events)
    {
        $events->listen(ConfigureForumRoutes::class, [$this, 'configureForumRoutes']);
    }

    /**
     * @param ConfigureForumRoutes $event
     */
    public function configureForumRoutes(ConfigureForumRoutes $event)
    {
        $event->get('/ueditor', 'ueditor', 'isoftstone\ueditor\UeditorController');
        $event->post('/ueditor', 'ueditor', 'isoftstone\ueditor\UeditorController');
        $event->get('/ueditor/resource/{path:.*}', 'ueditor', 'isoftstone\ueditor\ResourceController');
    }
}
